package com.bright.cwduijie.common.config;

import com.bright.cwduijie.common.util.StringUtil;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

@Slf4j
public class NumericStringSerializer extends JsonSerializer<String> {
 
    @Override
    public void serialize(String b, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        // 会计凭证分录 当是0
        log.debug("进入序列化代码");
        if (StringUtil.equals(b, "0.00")) {
            jsonGenerator.writeNull();
        }
    }
}